import { MutationTree } from 'vuex';
import { CommonState } from './state';
import { CommonMutationTypes } from './mutation-types';

export type Mutations<S = CommonState> = {
  [CommonMutationTypes.SET_BADGE](state: S, badge: number): void;
};

export const mutations: MutationTree<CommonState> & Mutations = {
  // 设置徽章值
  [CommonMutationTypes.SET_BADGE](state: CommonState, badge: number) {
    state.badge = badge;
  }
};
